/**
 * This is my code.
 *
 * $Id$
 */
package fi.jab.esb.config.xml.impl;

import fi.jab.esb.config.xml.ScheduledListenerType;
import fi.jab.esb.config.xml.XmlPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Scheduled Listener Type</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link fi.jab.esb.config.xml.impl.ScheduledListenerTypeImpl#getEventProcessor <em>Event Processor</em>}</li>
 *   <li>{@link fi.jab.esb.config.xml.impl.ScheduledListenerTypeImpl#isTransacted <em>Transacted</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ScheduledListenerTypeImpl extends AbstractScheduledListenerImpl implements ScheduledListenerType
{
  /**
   * The default value of the '{@link #getEventProcessor() <em>Event Processor</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getEventProcessor()
   * @generated
   * @ordered
   */
  protected static final String EVENT_PROCESSOR_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getEventProcessor() <em>Event Processor</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getEventProcessor()
   * @generated
   * @ordered
   */
  protected String eventProcessor = EVENT_PROCESSOR_EDEFAULT;

  /**
   * The default value of the '{@link #isTransacted() <em>Transacted</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #isTransacted()
   * @generated
   * @ordered
   */
  protected static final boolean TRANSACTED_EDEFAULT = false;

  /**
   * The cached value of the '{@link #isTransacted() <em>Transacted</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #isTransacted()
   * @generated
   * @ordered
   */
  protected boolean transacted = TRANSACTED_EDEFAULT;

  /**
   * This is true if the Transacted attribute has been set.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   * @ordered
   */
  protected boolean transactedESet;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ScheduledListenerTypeImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return XmlPackage.Literals.SCHEDULED_LISTENER_TYPE;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getEventProcessor()
  {
    return eventProcessor;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setEventProcessor(String newEventProcessor)
  {
    String oldEventProcessor = eventProcessor;
    eventProcessor = newEventProcessor;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, XmlPackage.SCHEDULED_LISTENER_TYPE__EVENT_PROCESSOR, oldEventProcessor, eventProcessor));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public boolean isTransacted()
  {
    return transacted;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setTransacted(boolean newTransacted)
  {
    boolean oldTransacted = transacted;
    transacted = newTransacted;
    boolean oldTransactedESet = transactedESet;
    transactedESet = true;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, XmlPackage.SCHEDULED_LISTENER_TYPE__TRANSACTED, oldTransacted, transacted, !oldTransactedESet));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void unsetTransacted()
  {
    boolean oldTransacted = transacted;
    boolean oldTransactedESet = transactedESet;
    transacted = TRANSACTED_EDEFAULT;
    transactedESet = false;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.UNSET, XmlPackage.SCHEDULED_LISTENER_TYPE__TRANSACTED, oldTransacted, TRANSACTED_EDEFAULT, oldTransactedESet));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public boolean isSetTransacted()
  {
    return transactedESet;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case XmlPackage.SCHEDULED_LISTENER_TYPE__EVENT_PROCESSOR:
        return getEventProcessor();
      case XmlPackage.SCHEDULED_LISTENER_TYPE__TRANSACTED:
        return isTransacted() ? Boolean.TRUE : Boolean.FALSE;
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case XmlPackage.SCHEDULED_LISTENER_TYPE__EVENT_PROCESSOR:
        setEventProcessor((String)newValue);
        return;
      case XmlPackage.SCHEDULED_LISTENER_TYPE__TRANSACTED:
        setTransacted(((Boolean)newValue).booleanValue());
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case XmlPackage.SCHEDULED_LISTENER_TYPE__EVENT_PROCESSOR:
        setEventProcessor(EVENT_PROCESSOR_EDEFAULT);
        return;
      case XmlPackage.SCHEDULED_LISTENER_TYPE__TRANSACTED:
        unsetTransacted();
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case XmlPackage.SCHEDULED_LISTENER_TYPE__EVENT_PROCESSOR:
        return EVENT_PROCESSOR_EDEFAULT == null ? eventProcessor != null : !EVENT_PROCESSOR_EDEFAULT.equals(eventProcessor);
      case XmlPackage.SCHEDULED_LISTENER_TYPE__TRANSACTED:
        return isSetTransacted();
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (eventProcessor: ");
    result.append(eventProcessor);
    result.append(", transacted: ");
    if (transactedESet) result.append(transacted); else result.append("<unset>");
    result.append(')');
    return result.toString();
  }

} //ScheduledListenerTypeImpl
